<template>
  <div id="content">
<!--宿舍通知-->
<!--    <i-panel title=" " :hide-top="true">-->
<!--      <view style="padding: 15px;">-->
<!--        <view class="caption-wrap">-->
<!--&lt;!&ndash;          <text class="caption-title">今日宿舍</text>&ndash;&gt;-->
<!--          <i-collapse :name="name">-->
<!--            <i-collapse-item :title="dormitoryMsg" name="name1">-->
<!--              <view slot="content">-->
<!--                今日宿舍楼停电停水一天-->
<!--              </view>-->
<!--            </i-collapse-item>-->
<!--          </i-collapse>-->
<!--        </view>-->
<!--      </view>-->
<!--    </i-panel>-->

    <van-collapse :value="activeNames" @change="onChange">
      <van-collapse-item title="今日通知" name="2">
        今日宿舍楼停电停水一天
      </van-collapse-item>
    </van-collapse>
<!--今日计划-->
    <i-panel title=" " :hide-top="true">
      <view style="padding: 15px;">
        <div>
          <i-row>
            <i-col span="20" i-class="col-class"> <span  class="todo">今日计划</span></i-col>
            <i-col span="4" i-class="col-class"><i-button type="warning" :inline="true" shape="square" size="small" @click="handleClick" >√</i-button></i-col>
          </i-row>
        </div>
        <i-steps :current="current">
          <i-step>
            <view slot="title">
              8: 00
            </view>
            <view slot="content">
              起床
            </view>
          </i-step>
          <i-step>
            <view slot="title">
              8: 30
            </view>
            <view slot="content">
              去吃饭
            </view>
          </i-step>
          <i-step>
            <view slot="title">
              8: 45
            </view>
            <view slot="content">
              上课迟到
            </view>
          </i-step>
          <i-step>
            <view slot="title">
              8: 45
            </view>
            <view slot="content">
              上课迟到
            </view>
          </i-step>
          <i-step>
            <view slot="title">
              8: 45
            </view>
            <view slot="content">
              上课迟到
            </view>
          </i-step>
        </i-steps>
      </view>
    </i-panel>
<!--宿舍账单-->
    <i-panel title=" " :hide-top="true">
      <view style="padding: 15px;">
        <div>
          <i-row>
            <i-col span="20" i-class="col-class"> <span  class="todo">宿舍账单</span></i-col>
            <i-col span="4" i-class="col-class"></i-col>
          </i-row>
        </div>
      </view>
    </i-panel>
<!--享去哪-->
    <i-panel title=" " :hide-top="true">
      <view style="padding: 15px;">
        <div>
          <i-row>
            <i-col span="20" i-class="col-class"> <span  class="todo">享去哪</span></i-col>
            <i-col span="4" i-class="col-class"></i-col>
          </i-row>
        </div>
      </view>
    </i-panel>
<!--去年今日-->
    <i-panel title=" " :hide-top="true">
      <view style="padding: 15px;">
        <div>
          <i-row>
            <i-col span="20" i-class="col-class"> <span  class="todo">去年今日</span></i-col>
            <i-col span="4" i-class="col-class"></i-col>
          </i-row>
        </div>
      </view>
    </i-panel>

    </div>
</template>

<script>
  import store from "../../store";
  export default {
    name: "index",
    data() {
      return {
        name: 'name1',
        dormitoryMsg: '9月29日通知',
        current: 0,
        step: 4,
        isShow: true,
        activeNames: ['1']
      }
    },
    components: {
    },
    methods: {
      handleClick() {
        const addCurrent = this.current + 1;
        const current1 = addCurrent > this.step ? 0 : addCurrent;
        this.current = current1;
        wx.login({
          success: function (res) {
            if (res.code) {
              //发起网络请求
              wx.request({
                url: 'https://yz1355826760.xyz/wx/user/wx0548ed802c4f7c99/login',
                data: {
                  code: res.code
                },
                success(res) {
                  console.log(res);
                }
              })
            } else {
              console.log('登录失败！' + res.errMsg)
            }
          }
        })
      },
      handleGetUserInfo() {
        wx.getUserInfo({
          success: (res) => {
            this.userInfo = res.userInfo;
            store.commit('setUserInfo', res.userInfo)
          },
          fail: (res) => {
            this.isShow = false
              wx.navigateTo({
                  url: '/pages/index/login/main'
              })
          }
        })
      },
      onChange(event) {
        this.activeNames = event.mp.detail
      }
    },
    beforeMount() {
      this.handleGetUserInfo()
      wx.login({
        success: function (res) {
          if (res.code) {
            //发起网络请求
            wx.request({
              url: 'https://yz1355826760.xyz/wx/user/wx0548ed802c4f7c99/login',
              data: {
                code: res.code
              },
              success(res) {
                console.log(res);
              }
            })
          } else {
            console.log('登录失败！' + res.errMsg)
          }
        }
      })
    }
  }
</script>

<style>
  page {
    /*background-color: #FFFAF0;*/
  }
  .todo {
    color: #9C9C9C;
    font-weight: bold;
    font-size: 50rpx;
  }

</style>
